package cn.ibizlab.odoo.core.odoo_stock.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Istock_move;
import cn.ibizlab.odoo.core.odoo_stock.domain.Stock_move;
import cn.ibizlab.odoo.core.odoo_stock.filter.Stock_moveSearchContext;
import cn.ibizlab.odoo.core.odoo_stock.service.IStock_moveService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[库存移动] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Stock_moveServiceImpl implements IStock_moveService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Istock_moveClientService stock_moveClientService;

    @Override
    public void createBatch(List<Stock_move> stock_moves, int batchSize) {

                        //stock_moveClientService.createBatch(stock_moves,batchSize) ;

    }

    @Override
    public Stock_move get(Integer id) {
        Istock_move clientModel = stock_moveClientService.createModel();
        clientModel.setId(id);
        stock_moveClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Stock_move get(Stock_move stock_move) {
        Stock_move retstock_move = this.get(stock_move.getId()) ;
    	BeanCopier copier=BeanCopier.create(retstock_move.getClass(), stock_move.getClass(), false);
        copier.copy(retstock_move, stock_move, null);
        return stock_move ;
    }

    @Override
    public boolean update(Stock_move stock_move) {
        boolean bOk = false ;
        Istock_move clientModel = this.convert2Model(stock_move,null);
        stock_moveClientService.update(clientModel) ;
        this.convert2Domain(clientModel,stock_move) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public boolean create(Stock_move stock_move) {
        boolean bOk = false ;
        Istock_move clientModel = this.convert2Model(stock_move,null);
        stock_moveClientService.create(clientModel) ;
        this.convert2Domain(clientModel,stock_move);
        bOk = true ;

        return bOk ;
    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //stock_moveClientService.removeBatch(stock_moves) ;

    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Istock_move clientModel = stock_moveClientService.createModel();
        clientModel.setId(id);
        stock_moveClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public void updateBatch(List<Stock_move> stock_moves, int batchSize) {

        //stock_moveClientService.updateBatch(stock_moves,batchSize) ;

    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Stock_move> searchDefault(Stock_moveSearchContext context) {
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据物料清单明细行查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_bom_line(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据Production Order查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_created_production(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据Production Order查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_production(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据Production Order查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_raw_material_production(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据工作中心使用情况查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_operation(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据拆解单查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_consume_unbuild(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据拆解单查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_unbuild(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据工单查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_workorder(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据产品包装查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_product_packging(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据产品查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_product(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据采购订单行查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_created_purchase_line(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据采购订单行查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_purchase_line(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据维修单查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_repair(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据公司查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_company(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_partner(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_restrict_partner(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_create(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_write(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据销售订单行查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_sale_line(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据库存查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_inventory(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据库存位置查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_location_dest(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据库存位置查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_location(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据库存移动查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_origin_returned_move(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据库存包装层级查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_package_level(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据拣货类型查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_picking_type(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据调拨查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_picking(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据库存规则查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_rule(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据仓库查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_warehouse(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据产品计量单位查询
     */
    @Override
    public Page<Stock_move> selectByOdoo_product_uom(Integer id){
        Stock_moveSearchContext context = new Stock_moveSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_move> list = new ArrayList<Stock_move>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_move> clientModelList = stock_moveClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_move clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_move>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Istock_move convert2Model(Stock_move domain , Istock_move model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = stock_moveClientService.createModel() ;
        }

         if(domain.getReturned_move_idsDirtyFlag())
            model.setReturned_move_ids(domain.getReturned_move_ids());
         if(domain.getAdditionalDirtyFlag())
            model.setAdditional(domain.getAdditional());
         if(domain.getPrice_unitDirtyFlag())
            model.setPrice_unit(domain.getPrice_unit());
         if(domain.getGroup_idDirtyFlag())
            model.setGroup_id(domain.getGroup_id());
         if(domain.getScrap_idsDirtyFlag())
            model.setScrap_ids(domain.getScrap_ids());
         if(domain.getAccount_move_idsDirtyFlag())
            model.setAccount_move_ids(domain.getAccount_move_ids());
         if(domain.getMove_dest_idsDirtyFlag())
            model.setMove_dest_ids(domain.getMove_dest_ids());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getTo_refundDirtyFlag())
            model.setTo_refund(domain.getTo_refund());
         if(domain.getUnit_factorDirtyFlag())
            model.setUnit_factor(domain.getUnit_factor());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getAvailabilityDirtyFlag())
            model.setAvailability(domain.getAvailability());
         if(domain.getRemaining_qtyDirtyFlag())
            model.setRemaining_qty(domain.getRemaining_qty());
         if(domain.getPropagateDirtyFlag())
            model.setPropagate(domain.getPropagate());
         if(domain.getReferenceDirtyFlag())
            model.setReference(domain.getReference());
         if(domain.getActive_move_line_idsDirtyFlag())
            model.setActive_move_line_ids(domain.getActive_move_line_ids());
         if(domain.getMove_line_nosuggest_idsDirtyFlag())
            model.setMove_line_nosuggest_ids(domain.getMove_line_nosuggest_ids());
         if(domain.getShow_details_visibleDirtyFlag())
            model.setShow_details_visible(domain.getShow_details_visible());
         if(domain.getProduct_qtyDirtyFlag())
            model.setProduct_qty(domain.getProduct_qty());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getOriginDirtyFlag())
            model.setOrigin(domain.getOrigin());
         if(domain.getProduct_uom_qtyDirtyFlag())
            model.setProduct_uom_qty(domain.getProduct_uom_qty());
         if(domain.getNeeds_lotsDirtyFlag())
            model.setNeeds_lots(domain.getNeeds_lots());
         if(domain.getPriorityDirtyFlag())
            model.setPriority(domain.getPriority());
         if(domain.getDateDirtyFlag())
            model.setDate(domain.getDate());
         if(domain.getRemaining_valueDirtyFlag())
            model.setRemaining_value(domain.getRemaining_value());
         if(domain.getOrder_finished_lot_idsDirtyFlag())
            model.setOrder_finished_lot_ids(domain.getOrder_finished_lot_ids());
         if(domain.getSequenceDirtyFlag())
            model.setSequence(domain.getSequence());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getMove_orig_idsDirtyFlag())
            model.setMove_orig_ids(domain.getMove_orig_ids());
         if(domain.getMove_line_idsDirtyFlag())
            model.setMove_line_ids(domain.getMove_line_ids());
         if(domain.getNoteDirtyFlag())
            model.setNote(domain.getNote());
         if(domain.getReserved_availabilityDirtyFlag())
            model.setReserved_availability(domain.getReserved_availability());
         if(domain.getIs_initial_demand_editableDirtyFlag())
            model.setIs_initial_demand_editable(domain.getIs_initial_demand_editable());
         if(domain.getQuantity_doneDirtyFlag())
            model.setQuantity_done(domain.getQuantity_done());
         if(domain.getIs_lockedDirtyFlag())
            model.setIs_locked(domain.getIs_locked());
         if(domain.getString_availability_infoDirtyFlag())
            model.setString_availability_info(domain.getString_availability_info());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getShow_reserved_availabilityDirtyFlag())
            model.setShow_reserved_availability(domain.getShow_reserved_availability());
         if(domain.getRoute_idsDirtyFlag())
            model.setRoute_ids(domain.getRoute_ids());
         if(domain.getStateDirtyFlag())
            model.setState(domain.getState());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getValueDirtyFlag())
            model.setValue(domain.getValue());
         if(domain.getFinished_lots_existDirtyFlag())
            model.setFinished_lots_exist(domain.getFinished_lots_exist());
         if(domain.getIs_doneDirtyFlag())
            model.setIs_done(domain.getIs_done());
         if(domain.getIs_quantity_done_editableDirtyFlag())
            model.setIs_quantity_done_editable(domain.getIs_quantity_done_editable());
         if(domain.getHas_move_linesDirtyFlag())
            model.setHas_move_lines(domain.getHas_move_lines());
         if(domain.getDate_expectedDirtyFlag())
            model.setDate_expected(domain.getDate_expected());
         if(domain.getProcure_methodDirtyFlag())
            model.setProcure_method(domain.getProcure_method());
         if(domain.getProduct_typeDirtyFlag())
            model.setProduct_type(domain.getProduct_type());
         if(domain.getUnbuild_id_textDirtyFlag())
            model.setUnbuild_id_text(domain.getUnbuild_id_text());
         if(domain.getScrappedDirtyFlag())
            model.setScrapped(domain.getScrapped());
         if(domain.getCompany_id_textDirtyFlag())
            model.setCompany_id_text(domain.getCompany_id_text());
         if(domain.getProduction_id_textDirtyFlag())
            model.setProduction_id_text(domain.getProduction_id_text());
         if(domain.getWarehouse_id_textDirtyFlag())
            model.setWarehouse_id_text(domain.getWarehouse_id_text());
         if(domain.getShow_operationsDirtyFlag())
            model.setShow_operations(domain.getShow_operations());
         if(domain.getCreated_production_id_textDirtyFlag())
            model.setCreated_production_id_text(domain.getCreated_production_id_text());
         if(domain.getCreated_purchase_line_id_textDirtyFlag())
            model.setCreated_purchase_line_id_text(domain.getCreated_purchase_line_id_text());
         if(domain.getLocation_dest_id_textDirtyFlag())
            model.setLocation_dest_id_text(domain.getLocation_dest_id_text());
         if(domain.getHas_trackingDirtyFlag())
            model.setHas_tracking(domain.getHas_tracking());
         if(domain.getPicking_type_id_textDirtyFlag())
            model.setPicking_type_id_text(domain.getPicking_type_id_text());
         if(domain.getSale_line_id_textDirtyFlag())
            model.setSale_line_id_text(domain.getSale_line_id_text());
         if(domain.getPartner_id_textDirtyFlag())
            model.setPartner_id_text(domain.getPartner_id_text());
         if(domain.getPicking_partner_idDirtyFlag())
            model.setPicking_partner_id(domain.getPicking_partner_id());
         if(domain.getRaw_material_production_id_textDirtyFlag())
            model.setRaw_material_production_id_text(domain.getRaw_material_production_id_text());
         if(domain.getOrigin_returned_move_id_textDirtyFlag())
            model.setOrigin_returned_move_id_text(domain.getOrigin_returned_move_id_text());
         if(domain.getRepair_id_textDirtyFlag())
            model.setRepair_id_text(domain.getRepair_id_text());
         if(domain.getBackorder_idDirtyFlag())
            model.setBackorder_id(domain.getBackorder_id());
         if(domain.getPurchase_line_id_textDirtyFlag())
            model.setPurchase_line_id_text(domain.getPurchase_line_id_text());
         if(domain.getPicking_id_textDirtyFlag())
            model.setPicking_id_text(domain.getPicking_id_text());
         if(domain.getProduct_id_textDirtyFlag())
            model.setProduct_id_text(domain.getProduct_id_text());
         if(domain.getLocation_id_textDirtyFlag())
            model.setLocation_id_text(domain.getLocation_id_text());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getProduct_uom_textDirtyFlag())
            model.setProduct_uom_text(domain.getProduct_uom_text());
         if(domain.getOperation_id_textDirtyFlag())
            model.setOperation_id_text(domain.getOperation_id_text());
         if(domain.getWorkorder_id_textDirtyFlag())
            model.setWorkorder_id_text(domain.getWorkorder_id_text());
         if(domain.getConsume_unbuild_id_textDirtyFlag())
            model.setConsume_unbuild_id_text(domain.getConsume_unbuild_id_text());
         if(domain.getProduct_packaging_textDirtyFlag())
            model.setProduct_packaging_text(domain.getProduct_packaging_text());
         if(domain.getRestrict_partner_id_textDirtyFlag())
            model.setRestrict_partner_id_text(domain.getRestrict_partner_id_text());
         if(domain.getInventory_id_textDirtyFlag())
            model.setInventory_id_text(domain.getInventory_id_text());
         if(domain.getProduct_tmpl_idDirtyFlag())
            model.setProduct_tmpl_id(domain.getProduct_tmpl_id());
         if(domain.getRule_id_textDirtyFlag())
            model.setRule_id_text(domain.getRule_id_text());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getPicking_codeDirtyFlag())
            model.setPicking_code(domain.getPicking_code());
         if(domain.getPicking_type_entire_packsDirtyFlag())
            model.setPicking_type_entire_packs(domain.getPicking_type_entire_packs());
         if(domain.getCreated_production_idDirtyFlag())
            model.setCreated_production_id(domain.getCreated_production_id());
         if(domain.getConsume_unbuild_idDirtyFlag())
            model.setConsume_unbuild_id(domain.getConsume_unbuild_id());
         if(domain.getSale_line_idDirtyFlag())
            model.setSale_line_id(domain.getSale_line_id());
         if(domain.getOrigin_returned_move_idDirtyFlag())
            model.setOrigin_returned_move_id(domain.getOrigin_returned_move_id());
         if(domain.getPicking_type_idDirtyFlag())
            model.setPicking_type_id(domain.getPicking_type_id());
         if(domain.getOperation_idDirtyFlag())
            model.setOperation_id(domain.getOperation_id());
         if(domain.getBom_line_idDirtyFlag())
            model.setBom_line_id(domain.getBom_line_id());
         if(domain.getRepair_idDirtyFlag())
            model.setRepair_id(domain.getRepair_id());
         if(domain.getProduct_idDirtyFlag())
            model.setProduct_id(domain.getProduct_id());
         if(domain.getUnbuild_idDirtyFlag())
            model.setUnbuild_id(domain.getUnbuild_id());
         if(domain.getProduction_idDirtyFlag())
            model.setProduction_id(domain.getProduction_id());
         if(domain.getCreated_purchase_line_idDirtyFlag())
            model.setCreated_purchase_line_id(domain.getCreated_purchase_line_id());
         if(domain.getWorkorder_idDirtyFlag())
            model.setWorkorder_id(domain.getWorkorder_id());
         if(domain.getProduct_uomDirtyFlag())
            model.setProduct_uom(domain.getProduct_uom());
         if(domain.getPicking_idDirtyFlag())
            model.setPicking_id(domain.getPicking_id());
         if(domain.getPartner_idDirtyFlag())
            model.setPartner_id(domain.getPartner_id());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getPackage_level_idDirtyFlag())
            model.setPackage_level_id(domain.getPackage_level_id());
         if(domain.getProduct_packagingDirtyFlag())
            model.setProduct_packaging(domain.getProduct_packaging());
         if(domain.getRestrict_partner_idDirtyFlag())
            model.setRestrict_partner_id(domain.getRestrict_partner_id());
         if(domain.getRule_idDirtyFlag())
            model.setRule_id(domain.getRule_id());
         if(domain.getWarehouse_idDirtyFlag())
            model.setWarehouse_id(domain.getWarehouse_id());
         if(domain.getLocation_dest_idDirtyFlag())
            model.setLocation_dest_id(domain.getLocation_dest_id());
         if(domain.getRaw_material_production_idDirtyFlag())
            model.setRaw_material_production_id(domain.getRaw_material_production_id());
         if(domain.getInventory_idDirtyFlag())
            model.setInventory_id(domain.getInventory_id());
         if(domain.getPurchase_line_idDirtyFlag())
            model.setPurchase_line_id(domain.getPurchase_line_id());
         if(domain.getLocation_idDirtyFlag())
            model.setLocation_id(domain.getLocation_id());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
        return model ;
    }

    public Stock_move convert2Domain( Istock_move model ,Stock_move domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Stock_move();
        }

        if(model.getReturned_move_idsDirtyFlag())
            domain.setReturned_move_ids(model.getReturned_move_ids());
        if(model.getAdditionalDirtyFlag())
            domain.setAdditional(model.getAdditional());
        if(model.getPrice_unitDirtyFlag())
            domain.setPrice_unit(model.getPrice_unit());
        if(model.getGroup_idDirtyFlag())
            domain.setGroup_id(model.getGroup_id());
        if(model.getScrap_idsDirtyFlag())
            domain.setScrap_ids(model.getScrap_ids());
        if(model.getAccount_move_idsDirtyFlag())
            domain.setAccount_move_ids(model.getAccount_move_ids());
        if(model.getMove_dest_idsDirtyFlag())
            domain.setMove_dest_ids(model.getMove_dest_ids());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getTo_refundDirtyFlag())
            domain.setTo_refund(model.getTo_refund());
        if(model.getUnit_factorDirtyFlag())
            domain.setUnit_factor(model.getUnit_factor());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getAvailabilityDirtyFlag())
            domain.setAvailability(model.getAvailability());
        if(model.getRemaining_qtyDirtyFlag())
            domain.setRemaining_qty(model.getRemaining_qty());
        if(model.getPropagateDirtyFlag())
            domain.setPropagate(model.getPropagate());
        if(model.getReferenceDirtyFlag())
            domain.setReference(model.getReference());
        if(model.getActive_move_line_idsDirtyFlag())
            domain.setActive_move_line_ids(model.getActive_move_line_ids());
        if(model.getMove_line_nosuggest_idsDirtyFlag())
            domain.setMove_line_nosuggest_ids(model.getMove_line_nosuggest_ids());
        if(model.getShow_details_visibleDirtyFlag())
            domain.setShow_details_visible(model.getShow_details_visible());
        if(model.getProduct_qtyDirtyFlag())
            domain.setProduct_qty(model.getProduct_qty());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getOriginDirtyFlag())
            domain.setOrigin(model.getOrigin());
        if(model.getProduct_uom_qtyDirtyFlag())
            domain.setProduct_uom_qty(model.getProduct_uom_qty());
        if(model.getNeeds_lotsDirtyFlag())
            domain.setNeeds_lots(model.getNeeds_lots());
        if(model.getPriorityDirtyFlag())
            domain.setPriority(model.getPriority());
        if(model.getDateDirtyFlag())
            domain.setDate(model.getDate());
        if(model.getRemaining_valueDirtyFlag())
            domain.setRemaining_value(model.getRemaining_value());
        if(model.getOrder_finished_lot_idsDirtyFlag())
            domain.setOrder_finished_lot_ids(model.getOrder_finished_lot_ids());
        if(model.getSequenceDirtyFlag())
            domain.setSequence(model.getSequence());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getMove_orig_idsDirtyFlag())
            domain.setMove_orig_ids(model.getMove_orig_ids());
        if(model.getMove_line_idsDirtyFlag())
            domain.setMove_line_ids(model.getMove_line_ids());
        if(model.getNoteDirtyFlag())
            domain.setNote(model.getNote());
        if(model.getReserved_availabilityDirtyFlag())
            domain.setReserved_availability(model.getReserved_availability());
        if(model.getIs_initial_demand_editableDirtyFlag())
            domain.setIs_initial_demand_editable(model.getIs_initial_demand_editable());
        if(model.getQuantity_doneDirtyFlag())
            domain.setQuantity_done(model.getQuantity_done());
        if(model.getIs_lockedDirtyFlag())
            domain.setIs_locked(model.getIs_locked());
        if(model.getString_availability_infoDirtyFlag())
            domain.setString_availability_info(model.getString_availability_info());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getShow_reserved_availabilityDirtyFlag())
            domain.setShow_reserved_availability(model.getShow_reserved_availability());
        if(model.getRoute_idsDirtyFlag())
            domain.setRoute_ids(model.getRoute_ids());
        if(model.getStateDirtyFlag())
            domain.setState(model.getState());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getValueDirtyFlag())
            domain.setValue(model.getValue());
        if(model.getFinished_lots_existDirtyFlag())
            domain.setFinished_lots_exist(model.getFinished_lots_exist());
        if(model.getIs_doneDirtyFlag())
            domain.setIs_done(model.getIs_done());
        if(model.getIs_quantity_done_editableDirtyFlag())
            domain.setIs_quantity_done_editable(model.getIs_quantity_done_editable());
        if(model.getHas_move_linesDirtyFlag())
            domain.setHas_move_lines(model.getHas_move_lines());
        if(model.getDate_expectedDirtyFlag())
            domain.setDate_expected(model.getDate_expected());
        if(model.getProcure_methodDirtyFlag())
            domain.setProcure_method(model.getProcure_method());
        if(model.getProduct_typeDirtyFlag())
            domain.setProduct_type(model.getProduct_type());
        if(model.getUnbuild_id_textDirtyFlag())
            domain.setUnbuild_id_text(model.getUnbuild_id_text());
        if(model.getScrappedDirtyFlag())
            domain.setScrapped(model.getScrapped());
        if(model.getCompany_id_textDirtyFlag())
            domain.setCompany_id_text(model.getCompany_id_text());
        if(model.getProduction_id_textDirtyFlag())
            domain.setProduction_id_text(model.getProduction_id_text());
        if(model.getWarehouse_id_textDirtyFlag())
            domain.setWarehouse_id_text(model.getWarehouse_id_text());
        if(model.getShow_operationsDirtyFlag())
            domain.setShow_operations(model.getShow_operations());
        if(model.getCreated_production_id_textDirtyFlag())
            domain.setCreated_production_id_text(model.getCreated_production_id_text());
        if(model.getCreated_purchase_line_id_textDirtyFlag())
            domain.setCreated_purchase_line_id_text(model.getCreated_purchase_line_id_text());
        if(model.getLocation_dest_id_textDirtyFlag())
            domain.setLocation_dest_id_text(model.getLocation_dest_id_text());
        if(model.getHas_trackingDirtyFlag())
            domain.setHas_tracking(model.getHas_tracking());
        if(model.getPicking_type_id_textDirtyFlag())
            domain.setPicking_type_id_text(model.getPicking_type_id_text());
        if(model.getSale_line_id_textDirtyFlag())
            domain.setSale_line_id_text(model.getSale_line_id_text());
        if(model.getPartner_id_textDirtyFlag())
            domain.setPartner_id_text(model.getPartner_id_text());
        if(model.getPicking_partner_idDirtyFlag())
            domain.setPicking_partner_id(model.getPicking_partner_id());
        if(model.getRaw_material_production_id_textDirtyFlag())
            domain.setRaw_material_production_id_text(model.getRaw_material_production_id_text());
        if(model.getOrigin_returned_move_id_textDirtyFlag())
            domain.setOrigin_returned_move_id_text(model.getOrigin_returned_move_id_text());
        if(model.getRepair_id_textDirtyFlag())
            domain.setRepair_id_text(model.getRepair_id_text());
        if(model.getBackorder_idDirtyFlag())
            domain.setBackorder_id(model.getBackorder_id());
        if(model.getPurchase_line_id_textDirtyFlag())
            domain.setPurchase_line_id_text(model.getPurchase_line_id_text());
        if(model.getPicking_id_textDirtyFlag())
            domain.setPicking_id_text(model.getPicking_id_text());
        if(model.getProduct_id_textDirtyFlag())
            domain.setProduct_id_text(model.getProduct_id_text());
        if(model.getLocation_id_textDirtyFlag())
            domain.setLocation_id_text(model.getLocation_id_text());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getProduct_uom_textDirtyFlag())
            domain.setProduct_uom_text(model.getProduct_uom_text());
        if(model.getOperation_id_textDirtyFlag())
            domain.setOperation_id_text(model.getOperation_id_text());
        if(model.getWorkorder_id_textDirtyFlag())
            domain.setWorkorder_id_text(model.getWorkorder_id_text());
        if(model.getConsume_unbuild_id_textDirtyFlag())
            domain.setConsume_unbuild_id_text(model.getConsume_unbuild_id_text());
        if(model.getProduct_packaging_textDirtyFlag())
            domain.setProduct_packaging_text(model.getProduct_packaging_text());
        if(model.getRestrict_partner_id_textDirtyFlag())
            domain.setRestrict_partner_id_text(model.getRestrict_partner_id_text());
        if(model.getInventory_id_textDirtyFlag())
            domain.setInventory_id_text(model.getInventory_id_text());
        if(model.getProduct_tmpl_idDirtyFlag())
            domain.setProduct_tmpl_id(model.getProduct_tmpl_id());
        if(model.getRule_id_textDirtyFlag())
            domain.setRule_id_text(model.getRule_id_text());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getPicking_codeDirtyFlag())
            domain.setPicking_code(model.getPicking_code());
        if(model.getPicking_type_entire_packsDirtyFlag())
            domain.setPicking_type_entire_packs(model.getPicking_type_entire_packs());
        if(model.getCreated_production_idDirtyFlag())
            domain.setCreated_production_id(model.getCreated_production_id());
        if(model.getConsume_unbuild_idDirtyFlag())
            domain.setConsume_unbuild_id(model.getConsume_unbuild_id());
        if(model.getSale_line_idDirtyFlag())
            domain.setSale_line_id(model.getSale_line_id());
        if(model.getOrigin_returned_move_idDirtyFlag())
            domain.setOrigin_returned_move_id(model.getOrigin_returned_move_id());
        if(model.getPicking_type_idDirtyFlag())
            domain.setPicking_type_id(model.getPicking_type_id());
        if(model.getOperation_idDirtyFlag())
            domain.setOperation_id(model.getOperation_id());
        if(model.getBom_line_idDirtyFlag())
            domain.setBom_line_id(model.getBom_line_id());
        if(model.getRepair_idDirtyFlag())
            domain.setRepair_id(model.getRepair_id());
        if(model.getProduct_idDirtyFlag())
            domain.setProduct_id(model.getProduct_id());
        if(model.getUnbuild_idDirtyFlag())
            domain.setUnbuild_id(model.getUnbuild_id());
        if(model.getProduction_idDirtyFlag())
            domain.setProduction_id(model.getProduction_id());
        if(model.getCreated_purchase_line_idDirtyFlag())
            domain.setCreated_purchase_line_id(model.getCreated_purchase_line_id());
        if(model.getWorkorder_idDirtyFlag())
            domain.setWorkorder_id(model.getWorkorder_id());
        if(model.getProduct_uomDirtyFlag())
            domain.setProduct_uom(model.getProduct_uom());
        if(model.getPicking_idDirtyFlag())
            domain.setPicking_id(model.getPicking_id());
        if(model.getPartner_idDirtyFlag())
            domain.setPartner_id(model.getPartner_id());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getPackage_level_idDirtyFlag())
            domain.setPackage_level_id(model.getPackage_level_id());
        if(model.getProduct_packagingDirtyFlag())
            domain.setProduct_packaging(model.getProduct_packaging());
        if(model.getRestrict_partner_idDirtyFlag())
            domain.setRestrict_partner_id(model.getRestrict_partner_id());
        if(model.getRule_idDirtyFlag())
            domain.setRule_id(model.getRule_id());
        if(model.getWarehouse_idDirtyFlag())
            domain.setWarehouse_id(model.getWarehouse_id());
        if(model.getLocation_dest_idDirtyFlag())
            domain.setLocation_dest_id(model.getLocation_dest_id());
        if(model.getRaw_material_production_idDirtyFlag())
            domain.setRaw_material_production_id(model.getRaw_material_production_id());
        if(model.getInventory_idDirtyFlag())
            domain.setInventory_id(model.getInventory_id());
        if(model.getPurchase_line_idDirtyFlag())
            domain.setPurchase_line_id(model.getPurchase_line_id());
        if(model.getLocation_idDirtyFlag())
            domain.setLocation_id(model.getLocation_id());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        return domain ;
    }


}
